public class SpeedRadar{
  public static double averageSpeed(int minLimit, int maxLimit, int[] readings){
  int number=readings.length;
  int infringements=0;
  for(int i=0;i<number;i++)
    if(readings[i]>maxLimit || readings[i]<minLimit)infringements++;
  double flag=number*0.1;
  if(flag<infringements) return 0.0;
  double average=0;
  int num=0;
  for(int i=0;i<number;i++)
    if(minLimit<=readings[i] && readings[i]<=maxLimit){num++;average=average+readings[i];}
  average=average/num;
  return average;
  }
  public static void main(String[] args){
	  int[]readings={42,45,48,50,52};
	  System.out.println(averageSpeed(1,50,readings));
  }
}